<template>
	<view class="container">
		<yxylCommonLog2 :logList="logs"></yxylCommonLog2>
		<view class="divider"></view>
		<view class="footer"><view class="btn" @tap="goToAdd">添加</view></view>
		<mescroll-empty v-if="logs.length==0"></mescroll-empty>
		
	</view>
</template>

<script>
import yxylCommonLog2 from '@/components/yxyl-common-log/yxyl-common-log-2.vue';
import MescrollEmpty from 'mescroll-uni/components/mescroll-empty.vue';
export default {
	components: { yxylCommonLog2,MescrollEmpty },
	data() {
		return {
			logs: [],
			communityId: ''
		};
	},
	onLoad(e) {
		this.communityId = e.CommunityId;
	},
	onShow() {
		this.logs=[];
		this.$http
			.request({
				url: 'api/Community/GetStudentList',
				data: {
					CommunityId: this.communityId
				}
			})
			.then(res => {
				// #ifdef H5
				this.$wechat.hideMenu();
				// #endif
				for (let index in res) {
					this.logs.push({
						title: `真实姓名：${res[index].userName}`,
						text1: `手机号：${res[index].telephone}`,
						text2: `性别：${res[index].sexualityStr}`,
						text3: `生日：${res[index].birthDayStr}`
					});
				}
			});
	},
	methods: {
		goToAdd() {
			uni.navigateTo({
				url: 'add?communityId=' + this.communityId
			});
		}
	}
};
</script>

<style lang="scss" scoped>
.divider {
	height: 100rpx;
}
.footer {
	position: fixed;
	bottom: 0;
	height: 80rpx;
	width: 100%;
	.btn {
		width: 100%;
		height: 100%;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #ffffff;
		font-size: 40rpx;
		background: $uni-color-main-dark;
	}
}
</style>
